package edu.egypt.popupsample;


import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.PopupWindow;
import android.widget.TextView;

public class PopupWindowSampleActivity extends Activity implements OnClickListener {

	private Button button;
	private Button button2;
	private PopupWindow window;

	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        button = (Button)findViewById(R.id.button1);
        button.setOnClickListener(this);
        button2 = (Button)findViewById(R.id.button2);
        button2.setOnClickListener(this);
    }

	@Override
	public void onClick(View v) {
		
		if(v.equals(button)){
			TextView t = new TextView(this);
			t.setText("Text goes here....");
			
			window = new PopupWindow(t, 70, 100, false);
			window.setAnimationStyle(-1);
			window.showAsDropDown(button);
		}else{
			window.dismiss();
		}
		
		
	}
}